package cj.web.quartz;

import java.util.HashMap;
import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;

import cj.web.admin.constants.Constants;
import cj.web.yc.domain.Member;
import cj.web.yc.service.MemberService;

/**
 * QuartzTask
 * @author hanmin
 *
 */
public class CrawlerPoolQuartzTask {
	
	private static Logger logger = Logger.getLogger(CrawlerPoolQuartzTask.class.getName());

	@Autowired
	private MemberService memberService;
	
	/**
	 * 抓取
	 * @throws Exception
	 */
	private void executeCrawlerPool() throws Exception{
		System.out.println("-------executeCrawlerPool-------");
	}
	
	private Map synchroMember(){
		Map rep =new HashMap();
		rep.put("returnFlag", Constants.returnObj.returnFlag_true);
		
		try {
			String phone ="";
			String name ="";
			String pwd ="";
			
			Member obj = memberService.queryByPhone(phone);
			if(obj!=null){
				Member member = new Member();
				member.setName(name);
				member.setPhone(phone);
				member.setPwd(pwd);
				member.setCreateUser("synchroMember");
				member.setUpdateUser("synchroMember");
				memberService.create(member);
			}else{
				Member member = new Member();
				member.setId(member.getId());
				member.setName(name);
				member.setPhone(phone);
				member.setPwd(pwd);
				member.setCreateUser("synchroMember");
				member.setUpdateUser("synchroMember");
				memberService.update(member);
			}
		} catch (Exception e) {
			// TODO: handle exception
			rep.put("returnFlag", Constants.returnObj.returnFlag_flase);
		}
		
		return rep;
	}
	
}